package cn.com.aiouyi.service.impl;

import org.springframework.stereotype.Service;

import cn.com.aiouyi.entity.Photo;
import cn.com.aiouyi.service.PhotoService;
import cn.com.aiouyi.util.AssertUtils;

/**
 * Service - 图片
 * @author hanson
 *
 */
@Service("photoServiceImpl")
public class PhotoServiceImpl extends BaseServiceImpl<Photo, Long> implements PhotoService{

	@Override
	public Photo update(Photo photo) {
		AssertUtils.notNull(photo);
		
		Photo pPhoto = this.find(photo.getId());
		if(photo.getAccessory() == null){
			photo.setAccessory(pPhoto.getAccessory());
		}
		
		return super.update(photo);
	}
}
